﻿<Page x:Class="MediaLibrary.NowPlayingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
    >    
    <Grid Name="LayoutRoot" MouseLeftButtonUp="OnMouseLeftButtonUp" MouseMove="OnMouseMove" Background="Transparent">        
        <Grid Name="mainGrid" Grid.Row="0" Grid.Column="0" Margin="0" Focusable="True" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="35"/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Name="mediaPlayerColumn" MinWidth="175" />
                <ColumnDefinition x:Name="playlistColumn" />
            </Grid.ColumnDefinitions>

            <Grid x:Name="mediaPlayerGrid" Grid.Row="0" Grid.Column="0" SizeChanged="mediaPlayerGrid_SizeChanged">
                <Grid.ContextMenu>
                    <ContextMenu>
                        <MenuItem x:Name="alwaysOnTopeMenuItem1" Header="Always On Top" Click="alwaysOnTopMenuItem_Click" />
                        <Separator />
                        <MenuItem x:Name="fullScreenMenuItem1" Header="Full Screen" Click="fullScreenMenuItem_Click" />
                        <Separator />
                        <MenuItem x:Name="showOnScreenControlsMenuItem1" Header="Remove On Screen Controls" Click="showOnScreenControlsMenuItem_Click" />
                    </ContextMenu>
                </Grid.ContextMenu>
                
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                
                <ContentPresenter x:Name="mediaInformationContentPresenter" />

                <ContentPresenter x:Name="mediaContentPresenter" MouseDown="mediaCanvas_MouseDown">
                    <ContentPresenter.ContextMenu>
                        <ContextMenu>
                            <MenuItem x:Name="alwaysOnTopeMenuItem" Header="Always On Top" Click="alwaysOnTopMenuItem_Click" />
                            <Separator />
                            <MenuItem x:Name="fullScreenMenuItem" Header="Full Screen" Click="fullScreenMenuItem_Click" />
                            <Separator />
                            <MenuItem x:Name="showOnScreenControlsMenuItem" Header="Remove On Screen Controls" Click="showOnScreenControlsMenuItem_Click" />
                        </ContextMenu>
                    </ContentPresenter.ContextMenu>
                </ContentPresenter>
            </Grid>

            <GridSplitter x:Name="playlistGridSplitter" ResizeDirection="Columns" Grid.Row="0" Grid.Column="0" Width="3" Focusable="False" Background="Gray" IsTabStop="False"  />

            <Grid x:Name="playlistGrid" Grid.Row="0" Grid.Column="1" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="28" />
                    <RowDefinition x:Name="playlistRow" Height="*" />
                </Grid.RowDefinitions>
                
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                
                <Rectangle Grid.Row="2"
                    Width="{Binding playlistColumn.Width}" 
                    Height="{Binding playlistColumn.Height}" 
                    Opacity=".8"
                    StrokeThickness="4"
                    Fill="Black">
                </Rectangle>
                
                <Menu Grid.Row="0" VerticalAlignment="Top" Background="Black" Width="{Binding playlistColumn.Width}" Height="26">
                    <MenuItem Header="Now Playing Options" Foreground="White" FontSize="14">                        
                        <MenuItem Header="Playlists" Foreground="Black">
                            <MenuItem Header="Save as Playlist" Click="savePlaylistMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Load Playlist from Collection" Click="loadPlaylistFromCollectionMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Load Playlist from File" Click="loadPlaylistMenuItem_OnClick" Foreground="Black" />
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="Add" Foreground="Black">
                            <MenuItem Header="Add File(s)" Click="addFileMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Add Playlist(s)" Click="addPlaylistMenuItem_OnClick" Foreground="Black" />
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="Remove" Foreground="Black">
                            <MenuItem Header="Remove All" Click="removeAllMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Remove Selected" Click="removeSelectedMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Crop" Click="cropMenuItem_OnClick" Foreground="Black" />
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="Select" Foreground="Black">
                            <MenuItem Header="Select All" Click="selectAllMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Invert Selection" Click="invertSelectionMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Clear Selection" Click="clearSelectionMenuItem_OnClick" Foreground="Black" />
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="Sort by..." Foreground="Black">
                            <MenuItem Header="Title" Click="sortByTitleMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Path and Filename" Click="sortByPathMenuItem_OnClick" Foreground="Black" />
                            <Separator />
                            <MenuItem Header="Randomize List" Click="randomizeMenuItem_OnClick" Foreground="Black" />
                            <MenuItem Header="Reverse List" Click="reverseListMenuItem_OnClick" Foreground="Black" />
                        </MenuItem>
                        <Separator />
                        <MenuItem Click="gotoMenuItem_OnClick" Foreground="Black">
                            <MenuItem.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Label Padding="0" Margin="0"><Underline>G</Underline></Label>
                                    <Label Padding="0" Margin="0">o to</Label>
                                </StackPanel>
                            </MenuItem.Header>
                        </MenuItem>
                    </MenuItem>
                </Menu>

                <ListView x:Name="nowPlayingListView" 
                 Grid.Row="1"
                 SelectionMode="Extended" 
                 ScrollViewer.CanContentScroll="False" 
                 AllowDrop="True" 
                 Opacity="1"
                 Background="Transparent"
                 BorderThickness="0"
                 ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                 KeyDown="nowPlayingListView_OnKeyDown" 
                 MouseDoubleClick="nowPlayingListView_OnMouseDoubleClick" 
                 Drop="nowPlayingListView_OnDrop"
                 Margin="7 0 0 0"
                 HorizontalContentAlignment="Stretch"
                 ItemContainerStyle="{DynamicResource selectedStyle}"
                 Mouse.PreviewMouseDown="nowPlayingListView_OnMouseLeftButtonDown"
                 MouseLeftButtonDown="nowPlayingListView_OnMouseLeftButtonDown">
                    <ListView.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Play Item" Click="playItemMenuItem_OnClick" />
                            <Separator />
                            <MenuItem Header="Crop Files" Click="cropMenuItem_OnClick" />
                            <MenuItem Header="Remove File(s)" Click="removeSelectedMenuItem_OnClick" />
                            <MenuItem Header="Remove All" Click="removeAllMenuItem_OnClick" />
                        </ContextMenu>
                    </ListView.ContextMenu>
                </ListView>          
            </Grid>

            <Grid Grid.Row="1" Grid.ColumnSpan="2">
                <Grid.RowDefinitions>
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="305" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="305" />
                </Grid.ColumnDefinitions>

                <StackPanel Grid.Column="0" Orientation="Horizontal" Margin="0,5,0,0">
                    <TextBlock Name="totalTimeTextBlock" Width="55" Foreground="Black" FontSize="14" VerticalAlignment="Center" />
                    <Slider Name="mediaTimeLineSlider" VerticalAlignment="Center" Focusable="False" Thumb.DragCompleted="mediaTimeLineSlider_DragCompleted" Thumb.DragStarted="mediaTimeLineSlider_DragStarted" Width="190"  />
                    <TextBlock Name="currentPlayTime" Width="55" Foreground="Black" FontSize="14" VerticalAlignment="Center" />
                </StackPanel>

                <StackPanel Grid.Column="2" Orientation="Horizontal" Margin="0,5,0,0">
                    <CheckBox x:Name="muteButton" VerticalAlignment="Center" ToolTip="Mute" Click="muteButton_OnClick" Margin="10,0,10,0" />
                    
                    <Slider x:Name="volumnSlider" Width="70" VerticalAlignment="Center" Orientation="Horizontal" IsSnapToTickEnabled="False" Focusable="False" Minimum="0" Maximum="1" ValueChanged="volumnSlider_OnValueChanged" />

                    <Button x:Name="stopButton" VerticalAlignment="Center" Click="stopButton_OnClick" Template="{StaticResource stopButton}" />

                    <Button x:Name="previousButton" VerticalAlignment="Center" Focusable="False" Click="previousButton_OnClick" Template="{StaticResource previousButton}" />

                    <ToggleButton x:Name="playButton" VerticalAlignment="Center" Click="playButton_OnClick" Template="{StaticResource playButton}" />

                    <Button x:Name="nextBotton" VerticalAlignment="Center" Click="nextButton_OnClick" Template="{StaticResource nextButton}" />

                    <CheckBox x:Name="randomCheckBox" VerticalAlignment="Center" ToolTip="Random" Click="randomCheckBox_OnClick" Margin="10,0,10,0"></CheckBox>

                    <CheckBox x:Name="repeatCheckBox" VerticalAlignment="Center" ToolTip="Repeat" Click="repeatCheckBox_OnClick" Margin="10,0,10,0"></CheckBox>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</Page>
